From 8ff2d82a7fa462adfd0c1b3a13c628551dbfc10b Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Wed, 13 Aug 2025 13:34:32 +0000 Subject: [PATCH] snap: pass -no-xattrs to unsquashfs unpacking files To work correctly on systems that use SELinux and extended attributes pass -no-xattrs when unpacking files. Signed-off-by: Zygmunt Krynicki Gbp-Pq: Name 0005-snap-pass-no-xattrs-to-unsquashfs-unpacking-files.patch --- snap/squashfs/squashfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snap/squashfs/squashfs.go b/snap/squashfs/squashfs.go index 1e5819ed..018a7b9e 100644 --- a/snap/squashfs/squashfs.go +++ b/snap/squashfs/squashfs.go @@ -202,7 +202,7 @@ func (s *Snap) Unpack(src, dstDir string) error { usw := newUnsquashfsStderrWriter() var output bytes.Buffer - cmd := exec.Command("unsquashfs", "-n", "-f", "-d", dstDir, s.path, src) + cmd := exec.Command("unsquashfs", "-no-xattrs", "-n", "-f", "-d", dstDir, s.path, src) cmd.Stderr = io.MultiWriter(&output, usw) if err := cmd.Run(); err != nil { return fmt.Errorf("cannot extract %q to %q: %v", src, dstDir, osutil.OutputErr(output.Bytes(), err)) @@ -234,7 +234,7 @@ func (s *Snap) withUnpackedFile(filePath string, f func(p string) error) error { defer os.RemoveAll(tmpdir) unpackDir := filepath.Join(tmpdir, "unpack") - if output, err := exec.Command("unsquashfs", "-n", "-i", "-d", unpackDir, s.path, filePath).CombinedOutput(); err != nil { + if output, err := exec.Command("unsquashfs", "-no-xattrs", "-n", "-i", "-d", unpackDir, s.path, filePath).CombinedOutput(); err != nil { return fmt.Errorf("cannot run unsquashfs: %v", osutil.OutputErr(output, err)) } -- 2.30.2